﻿#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
public class ButtonControl : MonoBehaviour {
    
    // Use this for initialization
    private void Awake()
    {
        Screen.fullScreen = true;
    }
    void Start () {
        List<string> buttonName = new List<string>();
        buttonName.Add("Start");
        buttonName.Add("Opinion");
        buttonName.Add("Exit");

        foreach (string name in buttonName)
        {
            GameObject btnObj = GameObject.Find(name);
            Button btn = btnObj.GetComponent<Button>();
            btn.onClick.AddListener(delegate () {
                this.OnClick(btnObj);
            });
        }
    }
    public void OnClick(GameObject sender)
    {
        switch (sender.name)
        {
            case "Start":
                //Debug.Log("Start");
                //跳转至载入场景
                SceneManager.LoadScene(1);
                break;
            case "Exit":
                Debug.Log("Exit");
                Application.Quit();
                break;
            case "Opinion":
                Debug.Log("Opinion");
                //
                break;
            default:
                Debug.Log("none");
                break;
        }
    }
    // Update is called once per frame
    void Update () {
		
	}
}
#endif